$(function(){
	/*获取豆豆明细*/
	
	var getTotal="";
	var pages;
	function getProblemList(){
		ym.ajax({
			url: "/user/getPoint",
			param:{
				pageSize:10,
			},
			success: function (data){
				console.log(data);
				if(data.res == 1){
					var listHTML="";
					pages = data.obj.pageNum;
					if(data.obj.results.length > 0){
						for(var i=0;i<data.obj.results.length;i++){
							var zhi = data.obj.results[i];
				   			listHTML+="<li>"+
	                            			"<p>"+zhi.createtime+"</p>"+
							        		"<p>"+zhi.changeDes+"</p>"+
							        		"<p>"+zhi.change+"</p>"+
							    		"</li>"
				   		}
				   		$('.minxi-list').append(listHTML);
					}else{
						listHTML = '<li class="w100" style="margin-left:30%"><img style="height:150px" src="../img/no.jpg"></li>';
						$('.minxi-list').append(listHTML);
					}
					
					
			   		if(data.obj.totalRecord > 10){
			   			console.log("sdf");
						$('.more').removeClass('none');
					}
				}else{console.log("数据获取失败!")}
				
			}
		});
	}
	getProblemList();
	/*获取豆豆总数*/
		ym.ajax({
			url: "/user/getNewestPoint",
			param:{
			},
			success: function (data) {
			   if(data.obj){
			   		$('#doudouTotal').html(data.obj);
			   }
			}
		});
		
	/*点击查看更多*/
	$('body').on('click','.more',function(){
		$("#my-modal-loading").modal('open');
		pages = pages + 1;
		ym.ajax({
			url: "/user/getPoint",
			param:{ 
				pageSize:10,
				pageNum:pages,
			},
			success:function(data){
				setTimeout(function(){
					$("#my-modal-loading").modal('close');
				},500)
				console.log(data);
				if(data.res == 1){
					var listHTML="";
					pages = data.obj.pageNum;
					for(var i=0;i<data.obj.results.length;i++){
						var zhi = data.obj.results[i];
			   			listHTML+='<li>'+
                            			"<p>"+zhi.createtime+"</p>"+
						        		"<p>"+zhi.changeDes+"</p>"+
						        		"<p>"+zhi.change+"</p>"+
						    		"</li>";
			   		}
			   		$('.minxi-list').append(listHTML);
			   		if(data.obj.results.length < 10){
						$('.more').html('');
						$('.more').html('<p>到底啦</p>');
						$('.more').removeClass('more');
					}
				}else{console.log("数据获取失败!")}
			}
		});
	})

})